<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LibCDS: /home/zsshen/Desktop/git-hub-code/C-Common-Data-Structures/include/tree/binary_tree.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LibCDS
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('binary__tree_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">binary_tree.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The basic binary search tree.  
<a href="#details">More...</a></p>

<p><a href="binary__tree_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structBinaryTree.html">BinaryTree</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The implementation for basic binary search tree.  <a href="structBinaryTree.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a28cc052d6379d1caedfebea6585de45c"><td class="memItemLeft" align="right" valign="top">typedef struct _BinTreeData&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a28cc052d6379d1caedfebea6585de45c">BinTreeData</a></td></tr>
<tr class="memdesc:a28cc052d6379d1caedfebea6585de45c"><td class="mdescLeft">&#160;</td><td class="mdescRight">BinTreeData is the data type for the container private information.  <a href="#a28cc052d6379d1caedfebea6585de45c">More...</a><br/></td></tr>
<tr class="separator:a28cc052d6379d1caedfebea6585de45c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa311b299217156f2c59f93d20eae6974"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#aa311b299217156f2c59f93d20eae6974">BinTreeInit</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> **ppObj)</td></tr>
<tr class="memdesc:aa311b299217156f2c59f93d20eae6974"><td class="mdescLeft">&#160;</td><td class="mdescRight">The constructor for <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a>.  <a href="#aa311b299217156f2c59f93d20eae6974">More...</a><br/></td></tr>
<tr class="separator:aa311b299217156f2c59f93d20eae6974"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a66101c0c35a67971c8f2796ed95f6228"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a66101c0c35a67971c8f2796ed95f6228">BinTreeDeinit</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> **ppObj)</td></tr>
<tr class="memdesc:a66101c0c35a67971c8f2796ed95f6228"><td class="mdescLeft">&#160;</td><td class="mdescRight">The destructor for <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a>.  <a href="#a66101c0c35a67971c8f2796ed95f6228">More...</a><br/></td></tr>
<tr class="separator:a66101c0c35a67971c8f2796ed95f6228"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65a05471b7ff1b28de6ab994656005e5"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a65a05471b7ff1b28de6ab994656005e5">BinTreeInsert</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> item)</td></tr>
<tr class="memdesc:a65a05471b7ff1b28de6ab994656005e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert an item into the tree.  <a href="#a65a05471b7ff1b28de6ab994656005e5">More...</a><br/></td></tr>
<tr class="separator:a65a05471b7ff1b28de6ab994656005e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abbf46d14f78993191392b966828fdb2b"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#abbf46d14f78993191392b966828fdb2b">BinTreeSearch</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> itemIn, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *pItemOut)</td></tr>
<tr class="memdesc:abbf46d14f78993191392b966828fdb2b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Search for the item having the same order with the designated one.  <a href="#abbf46d14f78993191392b966828fdb2b">More...</a><br/></td></tr>
<tr class="separator:abbf46d14f78993191392b966828fdb2b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae1e25eb0b7cc9dd1f48ebd603bef90fa"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#ae1e25eb0b7cc9dd1f48ebd603bef90fa">BinTreeDelete</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> item)</td></tr>
<tr class="memdesc:ae1e25eb0b7cc9dd1f48ebd603bef90fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete the item having the same order with the designated one.  <a href="#ae1e25eb0b7cc9dd1f48ebd603bef90fa">More...</a><br/></td></tr>
<tr class="separator:ae1e25eb0b7cc9dd1f48ebd603bef90fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aee8860e4695a5b5807721da22a3b748a"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#aee8860e4695a5b5807721da22a3b748a">BinTreeMaximum</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *pItem)</td></tr>
<tr class="memdesc:aee8860e4695a5b5807721da22a3b748a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the item having the maximum order of the tree.  <a href="#aee8860e4695a5b5807721da22a3b748a">More...</a><br/></td></tr>
<tr class="separator:aee8860e4695a5b5807721da22a3b748a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a63bca7f686e0268c9ad78dc325a2d0"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a8a63bca7f686e0268c9ad78dc325a2d0">BinTreeMinimum</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *pItem)</td></tr>
<tr class="memdesc:a8a63bca7f686e0268c9ad78dc325a2d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the item having the minimum order of the tree.  <a href="#a8a63bca7f686e0268c9ad78dc325a2d0">More...</a><br/></td></tr>
<tr class="separator:a8a63bca7f686e0268c9ad78dc325a2d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36e93f5a76a11db0d187f7f167d1ebcb"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a36e93f5a76a11db0d187f7f167d1ebcb">BinTreeSuccessor</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> itemIn, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *pItemOut)</td></tr>
<tr class="memdesc:a36e93f5a76a11db0d187f7f167d1ebcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the item which is the immediate successor of the designated item.  <a href="#a36e93f5a76a11db0d187f7f167d1ebcb">More...</a><br/></td></tr>
<tr class="separator:a36e93f5a76a11db0d187f7f167d1ebcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9879de28c30d94c40d3c8a476879716c"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a9879de28c30d94c40d3c8a476879716c">BinTreePredecessor</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> itemIn, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *pItemOut)</td></tr>
<tr class="memdesc:a9879de28c30d94c40d3c8a476879716c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the item which is the immediate predecessor of the designated item.  <a href="#a9879de28c30d94c40d3c8a476879716c">More...</a><br/></td></tr>
<tr class="separator:a9879de28c30d94c40d3c8a476879716c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab424ccf5559abc14a13f79bfba777e28"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#ab424ccf5559abc14a13f79bfba777e28">BinTreeSize</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self)</td></tr>
<tr class="memdesc:ab424ccf5559abc14a13f79bfba777e28"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of stored items.  <a href="#ab424ccf5559abc14a13f79bfba777e28">More...</a><br/></td></tr>
<tr class="separator:ab424ccf5559abc14a13f79bfba777e28"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab807f7884ec935ea00b572535ac1826a"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#ab807f7884ec935ea00b572535ac1826a">BinTreeSetCompare</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, int32_t(*pFunc)(<a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>))</td></tr>
<tr class="memdesc:ab807f7884ec935ea00b572535ac1826a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the custom item comparison method.  <a href="#ab807f7884ec935ea00b572535ac1826a">More...</a><br/></td></tr>
<tr class="separator:ab807f7884ec935ea00b572535ac1826a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a326e9e8fe0ab19d8d5b59217eebe42ca"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__tree_8h.html#a326e9e8fe0ab19d8d5b59217eebe42ca">BinTreeSetDestroy</a> (<a class="el" href="structBinaryTree.html">BinaryTree</a> *self, void(*pFunc)(<a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>))</td></tr>
<tr class="memdesc:a326e9e8fe0ab19d8d5b59217eebe42ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the custom item resource clean method.  <a href="#a326e9e8fe0ab19d8d5b59217eebe42ca">More...</a><br/></td></tr>
<tr class="separator:a326e9e8fe0ab19d8d5b59217eebe42ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The basic binary search tree. </p>

<p>Definition in file <a class="el" href="binary__tree_8h_source.html">binary_tree.h</a>.</p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="a28cc052d6379d1caedfebea6585de45c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct _BinTreeData <a class="el" href="binary__tree_8h.html#a28cc052d6379d1caedfebea6585de45c">BinTreeData</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>BinTreeData is the data type for the container private information. </p>

<p>Definition at line <a class="el" href="binary__tree_8h_source.html#l00011">11</a> of file <a class="el" href="binary__tree_8h_source.html">binary_tree.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aa311b299217156f2c59f93d20eae6974"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeInit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> **&#160;</td>
          <td class="paramname"><em>ppObj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The constructor for <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ppObj</td><td>The double pointer to the to be constructed tree</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOMEM</td><td>Insufficient memory for tree construction </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a66101c0c35a67971c8f2796ed95f6228"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BinTreeDeinit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> **&#160;</td>
          <td class="paramname"><em>ppObj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The destructor for <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a>. </p>
<p>If the custom resource clean method is set, it also runs the clean method for all the items.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ppObj</td><td>The double pointer to the to be destructed tree </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a65a05471b7ff1b28de6ab994656005e5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeInsert </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>&#160;</td>
          <td class="paramname"><em>item</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Insert an item into the tree. </p>
<p>This function inserts an item into the tree. If the order of the designated item is the same with a certain one stored in the tree, that item will be replaced. Also, if the custom resource clean method is set, it also runs the clean method for the replaced item.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">item</td><td>The designated item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NOMEM</td><td>Insufficient memory for tree extension </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="abbf46d14f78993191392b966828fdb2b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeSearch </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>&#160;</td>
          <td class="paramname"><em>itemIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *&#160;</td>
          <td class="paramname"><em>pItemOut</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Search for the item having the same order with the designated one. </p>
<p>This function searches for an item having the same order with the designated one. If such item can be found, it will be returned by the third parameter. Otherwise, the error code is returned and the third parameter is updated with NULL.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">itemIn</td><td>The designated item </td></tr>
    <tr><td class="paramname">pItemOut</td><td>The pointer to the returned item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>Non-existent item </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ae1e25eb0b7cc9dd1f48ebd603bef90fa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeDelete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>&#160;</td>
          <td class="paramname"><em>item</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Delete the item having the same order with the designated one. </p>
<p>This function first searches for the item having the same order with the designated one. If such item can be found, it will be removed. Also, if the custom resource clean method is set, it also runs the clean method for the removed item.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">item</td><td>The designated item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>Non-existent item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aee8860e4695a5b5807721da22a3b748a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeMaximum </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *&#160;</td>
          <td class="paramname"><em>pItem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the item having the maximum order of the tree. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">pItem</td><td>The pointer to the returned item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_IDX</td><td>Empty tree </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a8a63bca7f686e0268c9ad78dc325a2d0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeMinimum </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *&#160;</td>
          <td class="paramname"><em>pItem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the item having the minimum order of the tree. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">pItem</td><td>The pointer to the returned item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_IDX</td><td>Empty tree </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a36e93f5a76a11db0d187f7f167d1ebcb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeSuccessor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>&#160;</td>
          <td class="paramname"><em>itemIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *&#160;</td>
          <td class="paramname"><em>pItemOut</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the item which is the immediate successor of the designated item. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">itemIn</td><td>The designated item </td></tr>
    <tr><td class="paramname">pItemOut</td><td>The pointer to the returned item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>Non-existent immediate successor </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9879de28c30d94c40d3c8a476879716c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreePredecessor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>&#160;</td>
          <td class="paramname"><em>itemIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a> *&#160;</td>
          <td class="paramname"><em>pItemOut</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the item which is the immediate predecessor of the designated item. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">itemIn</td><td>The designated item </td></tr>
    <tr><td class="paramname">pItemOut</td><td>The pointer to the returned item</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>Non-existent immediate predecessor </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned item </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ab424ccf5559abc14a13f79bfba777e28"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeSize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the number of stored items. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of stored items </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ab807f7884ec935ea00b572535ac1826a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeSetCompare </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t(*)(<a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>, <a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>)&#160;</td>
          <td class="paramname"><em>pFunc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the custom item comparison method. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">pFunc</td><td>The function pointer to the custom method</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a326e9e8fe0ab19d8d5b59217eebe42ca"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t BinTreeSetDestroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structBinaryTree.html">BinaryTree</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(<a class="el" href="util_8h.html#a2583da5c1c14184068bda8cf681d5bed">Item</a>)&#160;</td>
          <td class="paramname"><em>pFunc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the custom item resource clean method. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to the <a class="el" href="structBinaryTree.html" title="The implementation for basic binary search tree. ">BinaryTree</a> structure </td></tr>
    <tr><td class="paramname">pFunc</td><td>The function pointer to the custom method</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_90ea79f90f3277a1d53059d67fa84fee.html">tree</a></li><li class="navelem"><a class="el" href="binary__tree_8h.html">binary_tree.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
